﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IWMAG.Scripting.AST.ObjectModel;
using IWMAG.Scripting.AST.Declarations;
using IWMAG.Scripting.Interpreter;

namespace IWMAG.Scripting.AST.Statements {
    internal class InlineStatements : CodeStatement {
        public List<CodeStatement> Statements = new List<CodeStatement>();

        public InlineStatements(Compiler.Lexeme l)
            : base(l) {
        }

        public override void Verify(Helpers.CompileTable sym, List<Compiler.IUserInfo> error) {
            foreach (CodeStatement stmnt in Statements) {
                stmnt.Verify(sym, error);
            }
        }

        public override IEnumerable<Continuation> Execute(Interpreter.ScriptEngine engine, Helpers.RuntimeTable sym) {
            foreach (CodeStatement statement in Statements) {
                foreach (Continuation wait in statement.Execute(engine, sym)) yield return wait;
            }
        }
    }
}
